<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    // 对象声明
    let pink = {
        // 属性
        username: '我想要天上的月亮',
        age: 18,
        gender: '女',

        // 方法
        eat: function () {
            console.log('吃点面条吧')
        }
    }

    // 查,两种方式
    console.log(pink.username)
    console.log(pink['username']);
    // 增
    pink.salary = 1200
    console.log(pink.salary)
    // 删(了解)
    delete pink.salary
    // 改
    pink.gender = '男'
    console.log(pink.gender)

    // 方法调用
    pink.eat()

    // 属性遍历,这里的pinkKey是个字符串
    for (let pinkKey in pink) {
        console.log(pinkKey + ':' + pink[pinkKey])
    }
</script>
</body>
</html>